<template>
  	<div class="comConfirmDialog-dialog-box" v-if="show">
    	<div class="dialog-content">
			<div class="dialog-title">{{ title }}</div>
			<div class="dialog-input">
				<input type="password" v-model="password" >
			</div>
			<!-- <div v-if="hasGoogleAuthenticator" class="dialog-title">{{ $t('请输入谷歌验证码') }}</div>
			<div class="dialog-input">
				<input type="password" v-model="googleAuthenticatorCode" >
			</div> -->
			<div class="dialog-line"></div>
			<div class="dialog-buttons">
				<button class="dialog-button cancel" @click="handleCancel">
					{{ cancelText }}
				</button>
					<button class="dialog-button confirm" @click="handleConfirm">
				{{ confirmText }}
				</button>
			</div>
    	</div>
  	</div>
</template>
  
<script>
	export default {
		data() {
			return {
				show: false,
				title: '',
				confirmText: '',
				cancelText: '',
				resolve: null,
				password:'',
				googleAuthenticatorCode: '',
			};
		},
		computed: {

		},
		methods: {
			open({ title, confirmText, cancelText ,hasGoogleAuthenticator}) {
				this.title = title || this.$t('提示')
				this.confirmText = confirmText || this.$t('确认')
				this.cancelText = cancelText || this.$t('取消')
				this.show = true;
				this.hasGoogleAuthenticator = hasGoogleAuthenticator;

				return new Promise((resolve) => {
					this.resolve = resolve;
				});
			},
			handleConfirm() {
				this.show = false;
				this.resolve && this.resolve(this.password,this.googleAuthenticatorCode);
			},
			handleCancel() {
				this.show = false;
				this.resolve && this.resolve(false);
			},
		},
	};
</script>
  
<style lang="less">
@import url("./index.less");
</style>